
interface NulResponse<R> {
  version: number;
  code: number;
  message: string;
  result: R;
}

interface NulRequest<R> {
  version: number;
  request: R;
}

/*
function createRequest<R>(request: R, version: number = 1): NulRequest<R> {
  return { version, request };
}
*/

function createRequest<R>(request: R): R {
  return request;
}

/*
function createEmptyRequest(version: number = 1): NulRequest<null> {
  return { version, request: null };
}
*/
function createEmptyRequest(): object {
  return {};
}

function createResponse<R>(result: R): NulResponse<R> {
  return {
    version: 1,
    code: 0,
    message: '',
    result
  };
}

export type { NulRequest, NulResponse };
export { createRequest, createEmptyRequest, createResponse };